package model

import "gitee.com/zaiqiang231/lovesport-user-service/app/model/meta"

type SysAuthority struct {
	meta.SysRecordModel
	AuthorityId   uint           `json:"authorityId" gorm:"not null;unique;primarykey;comment:角色ID;"` // 角色ID
	AuthorityName string         `json:"authorityName" gorm:"comment:角色名"`                            // 角色名
	ParentId      *uint          `json:"parentId" gorm:"comment:父角色ID"`                               // 父角色ID
	DefaultRouter string         `json:"defaultRouter" gorm:"comment:默认菜单;default:dashboard"`         // 默认菜单(默认dashboard)
	Children      []SysAuthority `json:"children" gorm:"-"`
	SysBaseMenus  []SysBaseMenu  `json:"menus" gorm:"many2many:sys_authority_menus;"`
	Users         []User         `json:"-" gorm:"many2many:sys_user_authority;"`
}

func (SysAuthority) TableName() string {
	return "sys_authorities"
}
